// 加密方案 crypto/md5 - 示例
package main

import(
	"crypto/md5"
	"fmt"
	"io"
)

func main() {
	h := md5.New()
	io.WriteString(h, "123456")
	password := fmt.Sprintf("%x", h.Sum(nil))
	fmt.Println("password:", password)

	//指定两个 salt：salt1 = @#$%; salt2 = ^&*()
	salt1 := "@#$%"
	salt2 := "^&*()"

	//salt1+用户名+salt2+MD5 拼接
	io.WriteString(h, salt1)
	io.WriteString(h, "abc")
	io.WriteString(h, salt2)
	io.WriteString(h, password)

	last := fmt.Sprintf("%x", h.Sum(nil))
	fmt.Println("salt password:", last)
}